package com.quanz.ckgl.services.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

/**
 * 商品图片信息
 * 
 * @author James Quan
 * @version 2015年10月4日 下午2:31:00
 */
@Entity
@Table(name = "PRODUCT_IMAGES")
public class ImageInfoEntity implements Serializable {
	private long id;
	private String productId;
	private String name;
	private long size;
	private String mimeType;
	private DateTime lastModified;

	@Id
	@GeneratedValue(generator = "qsIdGenerator")
	@GenericGenerator(name = "qsIdGenerator", strategy = "org.hibernate.id.enhanced.TableGenerator", parameters = {
			@Parameter(name = "table_name", value = "CKGL_SEQUENCES"),
			@Parameter(name = "segment_column_name", value = "ID_NAME"),
			@Parameter(name = "value_column_name", value = "ID_VAL"),
			@Parameter(name = "segment_value", value = "PRODUCT_IMAGES"),
			@Parameter(name = "increment_size", value = "1") })
	@Column(name = "ID")
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Column(name = "PRODUCTID")
	public String getProductId() {
		return productId;
	}

	public void setProductId(String productId) {
		this.productId = productId;
	}

	@Column(name = "NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "SIZE")
	public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	@Column(name = "MIMETYPE")
	public String getMimeType() {
		return mimeType;
	}

	public void setMimeType(String mimeType) {
		this.mimeType = mimeType;
	}
	
	@Column(name = "LASTMODIFIED", nullable = false)
	@Type(type = "com.quanz.ckgl.services.hibernate.DateTimeType")
	public DateTime getLastModified() {
		return lastModified;
	}

	public void setLastModified(DateTime lastModified) {
		this.lastModified = lastModified;
	}
}
